package com.itheima.demo09;

import java.io.*;
import java.net.Socket;

public class ClientDemo02 {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("127.0.0.1",10013);
        OutputStream os = s.getOutputStream();
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
        bw.write("我有一只小毛驴。。");
        bw.flush();
        s.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }
        os.close();
        s.close();
        br.close();
        bw.close();
    }
}
